import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '订单ID',
    align: "center",
    dataIndex: 'orderId'
  },
  {
    title: '用户ID',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '用户姓名',
    align: "center",
    dataIndex: 'userName'
  },
  {
    title: '护工ID',
    align: "center",
    dataIndex: 'nursesId'
  },
  {
    title: '护工姓名',
    align: "center",
    dataIndex: 'nursesName'
  },
  {
    title: '监护人ID',
    align: "center",
    dataIndex: 'familyId'
  },
  {
    title: '监护人姓名',
    align: "center",
    dataIndex: 'familyName'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '更新日期',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark'
  },
  {
    title: '佣金',
    align: "center",
    dataIndex: 'amt'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "用户姓名",
    field: "userName",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "护工姓名",
    field: "nursesName",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "监护人姓名",
    field: "familyName",
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: "status",
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_orders_nurses_status"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订单ID',
    field: 'orderId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入订单ID!' },
      ];
    },
  },
  {
    label: '用户ID',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入用户ID!' },
      ];
    },
  },
  {
    label: '用户姓名',
    field: 'userName',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入用户姓名!' },
      ];
    },
  },
  {
    label: '护工ID',
    field: 'nursesId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入护工ID!' },
      ];
    },
  },
  {
    label: '护工姓名',
    field: 'nursesName',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入护工姓名!' },
      ];
    },
  },
  {
    label: '监护人ID',
    field: 'familyId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入监护人ID!' },
      ];
    },
  },
  {
    label: '监护人姓名',
    field: 'familyName',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入监护人姓名!' },
      ];
    },
  },
  {
    label: '创建人',
    field: 'createBy',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入创建人!' },
      ];
    },
  },
  {
    label: '创建日期',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入创建日期!' },
      ];
    },
  },
  {
    label: '更新人',
    field: 'updateBy',
    component: 'Input',
  },
  {
    label: '更新日期',
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_orders_nurses_status"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入状态!' },
      ];
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '佣金',
    field: 'amt',
    component: 'InputNumber',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

//子表列表数据
export const nurseUserOrdersNursesExecuteColumns: BasicColumn[] = [
  {
    title: '图片',
    align: "center",
    dataIndex: 'pic',
    customRender: render.renderImage,
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '是否有效',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '订单分配ID',
    align: "center",
    dataIndex: 'ordersNursesId'
  },
];
//子表表单数据
export const nurseUserOrdersNursesExecuteFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '备注',
    field: 'remark',
    component: 'JEditor',
  },
  {
    label: '图片',
    field: 'pic',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 9
    },
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入创建时间!' },
      ];
    },
  },
  {
    label: '更新时间',
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '创建人',
    field: 'createBy',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入创建人!' },
      ];
    },
  },
  {
    label: '更新人',
    field: 'updateBy',
    component: 'Input',
  },
  {
    label: '是否有效',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "valid_status"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入是否有效!' },
      ];
    },
  },
  {
    label: '订单分配ID',
    field: 'ordersNursesId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入订单分配ID!' },
      ];
    },
  },
];

// 高级查询数据
export const superQuerySchema = {
  orderId: { title: '订单ID', order: 0, view: 'text', type: 'string', },
  userId: { title: '用户ID', order: 1, view: 'text', type: 'string', },
  userName: { title: '用户姓名', order: 2, view: 'text', type: 'string', },
  nursesId: { title: '护工ID', order: 3, view: 'text', type: 'string', },
  nursesName: { title: '护工姓名', order: 4, view: 'text', type: 'string', },
  familyId: { title: '监护人ID', order: 5, view: 'text', type: 'string', },
  familyName: { title: '监护人姓名', order: 6, view: 'text', type: 'string', },
  createBy: { title: '创建人', order: 7, view: 'text', type: 'string', },
  createTime: { title: '创建日期', order: 8, view: 'datetime', type: 'string', },
  updateBy: { title: '更新人', order: 9, view: 'text', type: 'string', },
  updateTime: { title: '更新日期', order: 10, view: 'datetime', type: 'string', },
  status: { title: '状态', order: 11, view: 'radio', type: 'string', },
  remark: { title: '备注', order: 12, view: 'text', type: 'string', },
  amt: { title: '佣金', order: 13, view: 'number', type: 'number', },
};
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}